package com.xidian.zhiancloud.dao.riskcontrol.riskidenva;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.xidian.zhiancloud.model.riskcontrol.TRiskTaskAllocationList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 风险辨识评价计划-分析评价任务分配
 */
public interface TRiskTaskAllocationMapper extends BaseMapper
        <TRiskTaskAllocationList> {

    Page<TRiskTaskAllocationList> getTRiskTaskAllocation(
            @Param("searchkey") String searchkey,
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("status") String status);

    List<TRiskTaskAllocationList> selectByNewTaskAll(
        @Param("companyId") Long companyId,
        @Param("triskidentevalsId") String triskidentevalsId);

    TRiskTaskAllocationList selectByTaskAllId(@Param("companyId") Long companyId,@Param("id") String id);
    
    //添加
    int insertTRiskTaskAllocationList
    (@Param("data") List<TRiskTaskAllocationList> list);

    List<TRiskTaskAllocationList> getCompanyIdAndPersonidenEva(
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("personidenEva") String personidenEva);

    List<TRiskTaskAllocationList> getCompanyIdAndDiscerner(
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("discerner") String discerner);

    List<TRiskTaskAllocationList> getCompanyIdAndEvaluator(
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("evaluator") String evaluator);

    List<TRiskTaskAllocationList> getById
            (@Param("companyId") Long companyId,
            @Param("id") String id);

    List<TRiskTaskAllocationList> getByIds
            (@Param("companyId") Long companyId,
             @Param("taskAllocatId") String taskAllocatId,String type);

    List<TRiskTaskAllocationList> selectById(
            @Param("companyId") Long companyId,
            List<String> list,@Param("states") String states);

    List<TRiskTaskAllocationList> selectByMoreId(@Param("companyId") Long companyId,List<String> list);

    List<TRiskTaskAllocationList> getByPersonidenevaId(Long companyId,String userId);

    List<TRiskTaskAllocationList> getByDiscernerId(Long companyId,String userId);

    List<TRiskTaskAllocationList> getByEvaluatorId(Long companyId,String userId);

    //根据分解人提供的ID进行查询
    int updateResolveById(List<String> idList);
    
    //根据辨识人提供的ID进行查询
    int updateByRecognizeId(List<String> idList);

    //根据评价人提供的ID进行查询
    int updateByAppraiseId(List<String> idList);

    ////根据部门审核人提供的ID进行查询
    int updateByDepaAuditId(List<String> idList);
    
    //编辑
    int updateEvaluationMethodIds(List<TRiskTaskAllocationList> list);

    //分解保存(保存辨识人和评价人)
    int insertDiscernerAndEvaluator(List<TRiskTaskAllocationList> list);

    //分析评价任务分配-删除按钮
    int removeTaskAllocation(List<String> list);
    
    int removeByTriskidentevalsId(Long companyId,String triskidentevalsId);

    //和风险辨识评价计划一并-删除
    int removeTRiskTaskAllocation(List<String> list);

    //发布(之后的状态为分解中)
    int releaseRTaskAllocation
    (@Param("companyId") Long companyId,@Param("id") String id,
     @Param("state") String state,
     @Param("status") String status);

    //派发按钮(派发之后的状态为辨识中)
    int decomposeRTaskAllocation(
            @Param("companyId") Long companyId,
            @Param("id") String id,
            @Param("state") String state,
            @Param("status") String status);

    //风险辨识提交按钮后的状态为--待评价
    int identificationTaskAllocat
        (@Param("companyId") Long companyId,List<String> list,
         @Param("state")  String state, @Param("status") String status);

    //待评价
    int estimateRTaskAllocation(
            @Param("companyId") Long companyId,
            @Param("id") String id,
            @Param("state") String state,
            @Param("status") String status);

    //待审核(评价提交之后修改为待审核状态)
    int evaluateRTaskAllocation(
            @Param("companyId") Long companyId,
            List<String> list,
            @Param("state") String state,
            @Param("status") String status);

    //评价中退回按钮(评级中的状态为辨识中)
    int evaluationDecomposeRTaskAllocation(
            @Param("companyId") Long companyId,
            List<String> list,
            @Param("state") String state,
            @Param("status") String status);

    //风险辨识评价计划-风险评价-风险点评价退回
    int sendBackTaskAllReturnReason
        (@Param("id") String id,@Param("state") String state,
         @Param("returnReason") String returnReason);

    //审核中退回按钮(审核中退回后的状态为辨识中)
    int auditDecomposeRTaskAllocation(
            @Param("companyId") Long companyId,
            @Param("id") String id,
            @Param("state") String state,
            @Param("status") String status);

    Page<TRiskTaskAllocationList> getCompanyIdAndPageTaskAll(
            @Param("searchkey") String searchkey,
            @Param("companyId") Long companyId,String id,
            @Param("userId") Long userId,String type);

    Page<TRiskTaskAllocationList> shreddedDataPage
        (@Param("searchkey") String searchkey,Long companyId,String id,Long userId);

    Page<TRiskTaskAllocationList> getCompanyIdAndPersonidenEva(
            @Param("searchkey") String searchkey,
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("personidenEva") String personidenEva);

    Page<TRiskTaskAllocationList> getCompanyIdAndDiscerner(
            @Param("searchkey") String searchkey,
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("discerner") String discerner);

    Page<TRiskTaskAllocationList> getCompanyIdAndEvaluator(
            @Param("searchkey") String searchkey,
            @Param("companyId") Long companyId,
            @Param("triskidentevalsId") String triskidentevalsId,
            @Param("state") String state,
            @Param("evaluator") String evaluator);

    //风险点分解保存后TaskAll中State修改为分解中(3)
    int updateByIdStateThree(List<String> list);

    //风险辨识后TaskAll中State修改为 已辨识/评价中(4)
    int updateByIdStateSeven(@Param("taskAllocatId") Integer taskAllocatId);

    //风险评价措施添加之后该条风险点状态要修改为 5 : 审核中/(已评价) 
    int updateByIdStateNine(@Param("taskAllocatId") Integer taskAllocatId);

    //评价审核-审核-审核-对象评价审核该条风险点状态要修改为已审核(10)
    int updateByIdStateEleven(@Param("id") Integer id,
        @Param("allid") String allid);

    //部门审核不通过
    int depaNoPassReview( @Param("companyId") Long companyId,
                    @Param("id") String id, @Param("state") String state,
                    @Param("status") String status);

    //部门审核通过
    int depaPassReview( @Param("companyId") Long companyId,
                    @Param("id") String id, @Param("state") String state,
                    @Param("status") String status);

    //安全部门不通过
    int securityNoPassReview( @Param("companyId") Long companyId,
                        @Param("id") String id, @Param("state") String state,
                        @Param("status") String status);

    //安全部门通过
    int securityPassReview( @Param("companyId") Long companyId,
                        @Param("id") String id, @Param("state") String state,
                        @Param("status") String status);


    //最终审核不通过
    int finalNoPassReview( @Param("companyId") Long companyId,
                     @Param("id") String id, @Param("state") String state,
                     @Param("status") String status);

    //最终审核通过
    int finalPassReview( @Param("companyId") Long companyId,
                     @Param("id") String id, @Param("state") String state,
                     @Param("status") String status);

    int updateByIdAndProposal
        (@Param("allid") String allid, @Param("proposal") String proposal);

    TRiskTaskAllocationList getByTrAlloAndId(@Param("id") String id);

    TRiskTaskAllocationList getByAllAndId(Long companyId,String id);
    
}
